package com.xy6.struct.graph;

import org.junit.Test;

public class UndirectedGraphTest {

	private UndirectedGraph g = new UndirectedGraph();
	
	private void init(){
		int[] v = { 0, 1, 2, 3 };
		int[][] e = {{0,1,1,1},{1,0,1,0},{1,1,0,1},{1,0,1,0}};
		g = new UndirectedGraph(v, e);
	}
	
	private void init2(){
		int[] v = { 0, 1, 2, 3 };
		int[][] e = {{0,1,0,1},{1,0,1,0},{0,1,0,1},{1,0,1,0}};
		g = new UndirectedGraph(v, e);
	}
	
	private void init3(){
		int[] v = { 0, 1, 2, 3, 4, 5 };
		int[][] e = {{0,1,0,1,0,0},{1,0,1,0,0,0},{0,1,0,1,0,0},{1,0,1,0,0,0},{0,0,0,0,0,1},{0,0,0,0,1,0}};
		g = new UndirectedGraph(v, e);
	}
	
	private void init4(){
		int[] v = { 0, 1, 2, 3 };
		int[][] e = {{0,1,3,4},{1,0,1,0},{3,1,0,1},{4,0,1,0}};
		g = new UndirectedGraph(v, e);
	}
	
	private void init5(){
		int[] v = { 0, 1, 2, 3 };
		int[][] e = {{0,1,0,0},{1,0,1,2},{0,1,0,2},{0,2,2,0}};
		g = new UndirectedGraph(v, e);
	}
	
	@Test
	public void testPrint1() {
		init();
		g.print();
	}
	
	@Test
	public void testPrintDegree1(){
		init();
		g.printDegree();
	}
	
	@Test
	public void testDFS21(){
		init2();
		g.iteratorDFS();
	}
	
	@Test
	public void testBFS22(){
		init2();
		g.iteratorBFS();
	}
	
	@Test
	public void testDFS31(){
		init3();
		g.iteratorDFS();
	}
	
	@Test
	public void testBFS32(){
		init3();
		g.iteratorBFS();
	}
	
	@Test
	public void testGetMinTreePrim1(){
		init();
		g.getMinTreePrim();
	}
	
	@Test
	public void testGetMinTreePrim2(){
		init2();
		g.getMinTreePrim();
	}
	
	@Test
	public void testGetMinTreePrim3(){
		init4();
		g.getMinTreePrim();
	}

	@Test
	public void testGetMinPath1(){
		init();
		g.getMinPathDFS(0, 3);
	}
	
	@Test
	public void testGetMinPath12(){
		init();
		g.getMinPathDFS(3, 1);
	}
	
	@Test
	public void testGetMinPath2(){
		init2();
		g.getMinPathDFS(0, 3);
	}
	
	@Test
	public void testGetMinPath3(){
		init3();
		g.getMinPathDFS(0, 3);
	}
	
	@Test
	public void testGetMinPath32(){
		init3();
		g.getMinPathDFS(1, 4);
	}
	
	@Test
	public void testGetMinPath4(){
		init4();
		g.getMinPathDFS(0, 3);
	}
	
	@Test
	public void testGetMinPath5(){
		init4();
		g.getMinPathDFS(1, 3);
	}
	
	@Test
	public void testGetMinPathDijkstra1(){
		init();
		g.getMinPathDijkstra(0, 3);
	}
	
	@Test
	public void testGetMinPathDijkstra2(){
		init2();
		g.getMinPathDijkstra(0, 2);
	}
	
	@Test
	public void testGetMinPathDijkstra31(){
		init3();
		g.getMinPathDijkstra(0, 3);
	}
	
	@Test
	public void testGetMinPathDijkstra32(){
		init3();
		g.getMinPathDijkstra(0, 4);
	}
	
	@Test
	public void testGetMinPathDijkstra41(){
		init4();
		g.getMinPathDijkstra(0, 3);
	}
	
	@Test
	public void testGetMinPathDijkstra42(){
		init4();
		g.getMinPathDijkstra(1, 3);
	}
	
	@Test
	public void testGetMinPathDijkstra43(){
		init4();
		g.getMinPathDijkstra(2, 0);
	}
	
	@Test
	public void testGetMinPathDijkstra5(){
		init5();
		g.getMinPathDijkstra(0, 3);
	}
	
	@Test
	public void testGetMinPathFloyd1(){
		init();
		g.getMinPathFloyd();
	}
	
}
